<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dbPoll_Application.ViewModels.ParticipantFieldViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	AddWeb
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<script type="text/javascript" src="../../Scripts/EditParticipant.js"></script>

    <div class="pageHeadingContainer"><h2 class="pageHeading">Add Participant - <%=Model.poll.name %></h2></div>
    <div id="contentContainer">
    <p><%= Html.ActionLink("Polls > ", "Index", "Poll", null, new { @class = "breadcrumb" })%><% if (Model.poll.pollID < 0)
                                                                                                 { %>New Poll <% } %><%= Model.poll.name %></p>
    <div id="pageMenuContainer">
        <span id="launchScreen"><%= Html.ActionLink("Go back to list of participants", "ListofParticipants", "Poll", new { pollID = Model.poll.pollID },null)%></span>
        <% var pollRoles = ViewData["pollRoles"] as ICollection<dbPoll_Application.Models.Role>;
           var pollAdministrator = new dbPoll_Application.Models.Role("Poll Administrator");
           var pollCreator = new dbPoll_Application.Models.Role("Poll Creator");
           var pollMaster = new dbPoll_Application.Models.Role("Poll Master"); %>
        <ul id="pageMenu">
            <li><%= Html.ActionLink("Details", "Questions", "Poll", new { pollID = Model.poll.pollID }, null) %></li>
            <li id="runLink" <% if (Model.poll.pollID < 0 || Model.poll.questions.Count == 0) { %> class="none" <% } %>><%= Html.ActionLink("Run", "SetSession", "Poll", new { pollID = Model.poll.pollID }, null) %></li>
            <li id="testLink" <% if (Model.poll.pollID < 0 || Model.poll.questions.Count == 0) { %> class="none" <% } %>><%= Html.ActionLink("Test", "Test", "Poll", new { pollID = Model.poll.pollID }, null) %></li>
            <li><%= Html.ActionLink("Reports", "Reports", "Poll", new { pollID = Model.poll.pollID }, null)%></li>
            <li><%= Html.ActionLink("Manage Hierarchy", "EntityHierarchy", "Poll", new { pollID = Model.poll.pollID }, null) %></li>
        </ul>
    </div>        
        <div class="respondTitle"><div class="respondTitlePadding">Add a Poll User</div></div>
        <div id="hierarchyContainer">
            <div id="respondQuestionContainerPadding">
            <div id="respondInstructions"><p>Both web and keypad users can be added. In addition to entering the Device IDs manually, you may simply press a number on any keypads you wish to add and they will show up on the list.</p>
            </div>
            <div id="respondOptionsContainer">
                <div>
                    <script type="text/javascript" src="http://www.java.com/js/deployJava.js"></script>
                        <div>
                            <script type="text/javascript">
                                var attributes = { code: 'KeypadListener', width: 0, height: 0 };
                                var parameters = { jnlp_href: '/keypadlistener-applet.jnlp', pollChannel: '<%= Model.poll.receiverChannel %>' };
                                deployJava.runApplet(attributes, parameters, '1.6'); 
                            </script>
                        </div>
                    <input type="hidden" id="message" />
                    <table>
                    <% using (Ajax.BeginForm("AddEmail", new AjaxOptions{UpdateTargetId="message", OnSuccess="addEmail" }))
                       { %>
                       <input type="hidden" id="pollID" value="<%=Model.poll.pollID %>" name="pollID" />
                       <tr><td><label for="email">Add Email Address:</label></td><td><%=Html.TextBoxFor(m=>m.email) %></td>
                       <td><input type="submit" id="submitWebUser" value="Add Web User" /></td></tr>      
                    <% } %>
                    <tr><td><label for="deviceID">Add Device ID:</label></td><td><%=Html.TextBox("deviceID") %></td><td><input type="button" id="submitKeypadUser" value="Add Keypad User" /></td></tr>
                    <%/* using (Ajax.BeginForm("AddBulk", new AjaxOptions{UpdateTargetId="message", OnSuccess="addBulk" }))
                       { %><input type="hidden" id="pollID" value="<%=Model.poll.pollID %>" name="pollID" />
                           <tr><td><label for="bulk">Add Bulk Username:</label></td><td><%=Html.DropDownListFor(m=>m.bulk,Model.bulk) %></td>
                           <td><input type="submit" id="submitBulkUser" value="Add Bulk User" /></td></tr>      
                    <% }*/ %>
                       </table></div>
                    <input id="pollid" value="<%=Model.poll.pollID %>" type="hidden" />
                    <input id="pollname" value="<%=Model.poll.name %>" type="hidden" />
                    <div id="bulkAddKeypadContainer">
                        <div id="bulkAddKeypadMessage">Any keypad or web users you add will be shown here.</div>
                    </div>
            </div>
        </div>
        </div>
    </div>
    
</asp:Content>
